import { defHttp } from '/@/utils/http/axios';

enum Api {
  AddTask = '/web/safe/check/task/add',
  DelTask = '/web/safe/check/task/delete/{id}',
  GetTaskInfo = '/web/safe/check/task/detail/{id}',
  UpdateTask = '/web/safe/check/task/edit',
  TenantList = '/web/system/tenant/list',
  GetTaskList = '/web/safe/check/task/list',
  UpdateTaskStatus = '/web/safe/check/task/status/change',
  PersonList = '/web/system/tenant/personage/list',
  AddProblem = '/web/safe/check/task/problem/add',
  DetailProblem = `/web/safe/check/task/problem/detail/`,
  DeleteProblem = '/web/safe/check/task/problem/delete/{id}',
  UpdateProblem = '/web/safe/check/task/problem/edit',
}

/**
 * @description: 新增检查记录
 */
export function AddTask(params: any) {
  return defHttp.post<any>({
    url: Api.AddTask,
    params,
  });
}
/**
 * @description: 删除检查记录
 */
export function delTask(params: any) {
  return defHttp.post<any>({
    url: Api.DelTask,
    params,
  });
}
/**
 * @description: 获取检查记录信息
 */
export function getTaskInfo(params: any) {
  return defHttp.get<any>({
    url: Api.GetTaskInfo,
    params,
  });
}

/**
 * @description: 更新检查记录
 */
export function updateTask(params: any) {
  return defHttp.post<any>({
    url: Api.UpdateTask,
    params,
  });
}

/**
 * @description: 获取检查记录列表
 */
export function getTaskList(params: any) {
  return defHttp.post<any>({
    url: Api.GetTaskList,
    params,
  });
}

/**
 * @description: 更新检查记录状态
 */
export function updateTaskStatus(params: any) {
  return defHttp.post<any>({
    url: Api.UpdateTaskStatus,
    params,
  });
}

/**
 * @description: 被检查机构列表
 */
export function tenantList(params: any) {
  return defHttp.post<any>({
    url: Api.TenantList,
    params,
  });
}

/**
 * @description: 被检查机构列表
 */
export function personList(params: any) {
  return defHttp.post<any>({
    url: Api.PersonList,
    params,
  });
}

/**
 * @description: 安全检查问题单添加
 */
export function addProblem(params: any) {
  return defHttp.post<any>({
    url: Api.AddProblem,
    params,
  });
}

/**
 * @description: 安全检查问题单添加
 */
export function updateProblem(params: any) {
  return defHttp.post<any>({
    url: Api.UpdateProblem,
    params,
  });
}

/**
 * @description: 安全检查问题单详情
 */
export function detailProblem(params: any) {
  return defHttp.get<any>({
    url: Api.DetailProblem + params.id,
    params,
  });
}

/**
 * @description: 删除安全检查问题
 */
export function deleteProblem(params: any) {
  return defHttp.post<any>({
    url: Api.DeleteProblem,
    params,
  });
}
